package com.llly.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.llly.mapper.NewsMapper;
import com.llly.pojo.Easybuy_news;
import com.llly.service.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

//资讯中心——业务逻辑实现层
@Service
public class NewsServiceImpl implements NewsService {


    @Autowired
    private NewsMapper newsMapper;


    //分页带查询
    @Override
    public Page<Easybuy_news> showNews(Integer pageIndex) {
        System.out.println("000000000000**********"+pageIndex);
        Page<Easybuy_news> page = PageHelper.startPage(pageIndex==null?1:pageIndex,10);
        newsMapper.showAllNews();
        System.out.println("111111111111**********"+page);
       return page;
    }

    //增
    @Override
    public int addNews(Easybuy_news en) {
        return newsMapper.addNews(en);
    }

    //删
    @Override
    public int delNews(int id) {

        return newsMapper.delNews(id);
    }

    //改1
    @Override
    public int updateNew(Easybuy_news en) {

        return newsMapper.updateNew(en);
    }

    //根据指定id查询
    @Override
    public Easybuy_news findByid(int id) {

        return newsMapper.findByid(id);
    }

    @Override
    public List<Easybuy_news> IndexShowAll() {
        return newsMapper.IndexShowAll();
    }

    @Override
    public Easybuy_news newsView(Integer id) {
        return newsMapper.newsView(id);
    }
}
